//-----------------------------------------------------------------------
// <copyright file="ArticleSubCatService.cs" company="FetCo">
//     Copyright (c) FetCo. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------	

using System;
using System.Collections;
using FetCo.Framework;
using ADESSA.Entities;
using ADESSA.Data;
    
namespace ADESSA.Business
{   
	/// <summary>
	/// 
	/// </summary> 
    public class ArticleSubCatService
    {
        #region ArticleSubCat

        public static void CreateArticleSubCat(ArticleSubCat articleSubCat)
        {            
            try
            {
                ArticleSubCatDAO articleSubCatDAO = new ArticleSubCatDAO();
                articleSubCatDAO.CreateArticleSubCat(articleSubCat);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessCreateArticleSubCatException, ex);
            }
        }        

        public static void UpdateArticleSubCat(ArticleSubCat articleSubCat)
        {            
            try
            {
                ArticleSubCatDAO articleSubCatDAO = new ArticleSubCatDAO();
                articleSubCatDAO.UpdateArticleSubCat(articleSubCat);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessUpdateArticleSubCatException, ex);
            }
        }        

        public static void DeleteArticleSubCat(long subCategoryID)
        {            
            try
            {
                ArticleSubCatDAO articleSubCatDAO = new ArticleSubCatDAO();
                articleSubCatDAO.DeleteArticleSubCat(subCategoryID);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessDeleteArticleSubCatException, ex);
            }
        }
        
        public static ArticleSubCat GetArticleSubCat(long subCategoryID)
        {            
            try
            {
                ArticleSubCatDAO articleSubCatDAO = new ArticleSubCatDAO();
                return articleSubCatDAO.GetArticleSubCat(subCategoryID);                
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetArticleSubCatException, ex);
            }
        }                

        public static ArticleSubCatCollection GetArticleSubCatList(ArticleSubCatColumns orderBy, OrderDirection orderDirection)
        {            
            try
            {
                ArticleSubCatDAO articleSubCatDAO = new ArticleSubCatDAO();
                return articleSubCatDAO.GetArticleSubCatList(orderBy, orderDirection);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetArticleSubCatListException, ex);
            }
        }        

        public static ArticleSubCatCollection GetArticleSubCatList(ArticleSubCatColumns orderBy, OrderDirection orderDirection, int page, int pageSize, out int totalRecords)
        {            
            try
            {
                ArticleSubCatDAO articleSubCatDAO = new ArticleSubCatDAO();
                return articleSubCatDAO.GetArticleSubCatList(orderBy, orderDirection, page, pageSize, out totalRecords);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetArticleSubCatListException, ex);
            }
        }        

	    public static ArticleSubCatCollection GetArticleSubCatListByParam(object orderBy, OrderDirection orderDirection,string where)
        {            
            try
            {
                ArticleSubCatDAO articleSubCatDAO = new ArticleSubCatDAO();
                return articleSubCatDAO.GetArticleSubCatListByParam(orderBy, orderDirection,where);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetArticleSubCatListException, ex);
            }
        }        

        public static ArticleSubCatCollection GetArticleSubCatListByParam(object orderBy, OrderDirection orderDirection, int page, int pageSize,string Criteria, out int totalRecords)
        {            
            try
            {
                ArticleSubCatDAO articleSubCatDAO = new ArticleSubCatDAO();
                return articleSubCatDAO.GetArticleSubCatListByParam(orderBy, orderDirection, page, pageSize,Criteria, out totalRecords);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetArticleSubCatListException, ex);
            }
        }        

        #endregion
    }
}